// 获取所有的icon
import * as IconMaps from '@ant-design/icons-vue';
import { reactive, h } from 'vue';
const systemIconMaps = reactive([]);

/**
 * @description: 获取所有的系统icon
 */
Object.keys(IconMaps).forEach(key => {
  if (!['createFromIconfontCN', 'default', 'getTwoToneColor', 'setTwoToneColor']?.includes(key)) {
    systemIconMaps.push(key);
  }
});

// 引入iconfont
const iconFontMaps = IconMaps.createFromIconfontCN({
  scriptUrl: import('//at.alicdn.com/t/c/font_2971146_1btn8v6bccv.js'), // 在 iconfont.cn 上生成
});

// console.log(iconFontMaps);

// 渲染ICON-FONT
const IconFont = (props, { slots }) => {
  return h(
    iconFontMaps,
    {
      type: props.type,
      size: props.size,
      spin: props.spin,
      rotate: props.rotate,
      style: props.style,
    },
    slots
  );
};

export { systemIconMaps };
